package com.nms.action;

import java.util.List;

import com.nms.model.News;
import com.nms.model.pojo.NewsTypeContainer;
import com.nms.service.DictionaryService;
import com.nms.service.NewsService;
import com.opensymphony.xwork2.ActionSupport;

public class JumpAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<News> newsList;
	private NewsTypeContainer ntContainer;
	private NewsService newsService;
	private DictionaryService dictionaryService;
	
	public JumpAction(){
		ntContainer = new NewsTypeContainer();
	}
	
	public String managerLogin(){
		return "managerLogin";
	}
	public String register(){
		return "register";
	}
	public String showIndexPage() {
		return "showIndexPage";
	}

	public String applications() {
		return "applications";
	}

	public String download() {
		return "download";
	}
	
	@Override
	public String execute(){
		newsList = newsService.findHomepageNews();
		System.out.println("news list size = " + newsList.size());
		return "index";
	}
	public List<News> getNewsList() {
		return newsList;
	}
	public void setNewsList(List<News> newsList) {
		this.newsList = newsList;
	}
	public NewsTypeContainer getNtContainer() {
		return ntContainer;
	}
	public void setNtContainer(NewsTypeContainer ntContainer) {
		this.ntContainer = ntContainer;
	}
	public NewsService getNewsService() {
		return newsService;
	}
	public void setNewsService(NewsService newsService) {
		this.newsService = newsService;
	}
	public DictionaryService getDictionaryService() {
		return dictionaryService;
	}
	public void setDictionaryService(DictionaryService dictionaryService) {
		this.dictionaryService = dictionaryService;
		this.ntContainer.setNewsType1(dictionaryService.findNewsTypesByType(1));
		this.ntContainer.setNewsType2(dictionaryService.findNewsTypesByType(2));
		this.ntContainer.setNewsType3(dictionaryService.findNewsTypesByType(3));
	}
}
